-
Notifications
You must be signed in to change notification settings - Fork 82
[Discounts] REST API #2780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discounts] REST API #2780
Conversation
Preview of modified filesPreview of modified Markdown: |
35978c8
to
636c53c
Compare
docs/api/rest_api/rest_api_reference/input/ibexa-discounts.raml
Outdated
Show resolved
Hide resolved
* [PHP API REF] Added Discount packages * Generated PHP API for Discounts
* [Discounts] Added event reference * Fixed links * Fixes before review * Removed column
* Mentioned discounts in pricing and customer groups * Before review fixes * Added mention to the PIM guide
* Permissions * Build fixes * Fixed links * Fixed last links * Removed link * Apply suggestions from code review Co-authored-by: julitafalcondusza <[email protected]> --------- Co-authored-by: julitafalcondusza <[email protected]>
* Added update instructions * Fixed link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some error responses are missing but this isn't really important.
JSON object type description is incomplete as the wrapped XML part isn't accessible.
...est_api_reference/input/examples/discount_codes/apply/POST/DiscountCodeResponse.json.example
Outdated
Show resolved
Hide resolved
docs/api/rest_api/rest_api_reference/input/ibexa-discounts.raml
Outdated
Show resolved
Hide resolved
docs/api/rest_api/rest_api_reference/input/ibexa-discounts.raml
Outdated
Show resolved
Hide resolved
responses: | ||
200: | ||
body: | ||
application/vnd.ibexa.api.Discount+json: | ||
type: DiscountWrapper | ||
example: !include examples/discounts/POST/DiscountCreateResponse.json.example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is likely some error responses as well. Probably 403 if user haven't the rights to create a discount and 500 if the payload is malformed.
It might not worth spending too much time into completing this in 4.6 RAML. It will be more important in 5.0 OpenAPI.
Remember https://redocly.com/docs/cli/rules/oas/operation-4xx-response 😉
DiscountListWrapper: | ||
type: object | ||
description: 'Wrapper object for DiscountList.' | ||
properties: | ||
DiscountList: | ||
type: DiscountList | ||
description: 'Object containing a list of discounts.' | ||
|
||
DiscountList: | ||
type: object | ||
description: 'Object containing a list of discounts.' | ||
properties: | ||
Discount: | ||
type: array | ||
items: | ||
type: object | ||
properties: | ||
identifier: | ||
type: string | ||
description: "Discount identifier." | ||
type: | ||
type: string | ||
description: "Discount type: cart or catalog." | ||
priority: | ||
type: integer | ||
description: "Discount priority." | ||
isEnabled: | ||
type: boolean | ||
description: "Indicates whether the discount is enabled." | ||
userId: | ||
type: integer | ||
description: "User ID of discount creator." | ||
rule: | ||
type: object | ||
description: "Describes how the discount is calculated: percentage or fixed." | ||
properties: | ||
type: | ||
type: string | ||
description: "Discount type." | ||
amount: | ||
type: integer | ||
description: "Discount amount." | ||
startDate: | ||
type: datetime | ||
description: "Defines when the discount starts." | ||
endDate: | ||
type: datetime | ||
description: "Defines when the discount starts." | ||
translations: | ||
type: array | ||
description: "Translations of discount data." | ||
items: | ||
type: object | ||
properties: | ||
languageCode: | ||
type: string | ||
name: | ||
type: string | ||
description: | ||
type: string | ||
label: | ||
type: string | ||
labelDescription: | ||
type: string | ||
conditions: | ||
type: array | ||
description: "List of discount conditions." | ||
items: | ||
type: DiscountCondition |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As only JSON is used, DiscountList can't be displayed.
When there is both, this no big deal that the Wrapper description is short, just close the JSON Wrapper type description and open the XML type description.
But here, there is no such possibility.
I would move DiscountList under its wrapper.
DiscountListWrapper: | |
type: object | |
description: 'Wrapper object for DiscountList.' | |
properties: | |
DiscountList: | |
type: DiscountList | |
description: 'Object containing a list of discounts.' | |
DiscountList: | |
type: object | |
description: 'Object containing a list of discounts.' | |
properties: | |
Discount: | |
type: array | |
items: | |
type: object | |
properties: | |
identifier: | |
type: string | |
description: "Discount identifier." | |
type: | |
type: string | |
description: "Discount type: cart or catalog." | |
priority: | |
type: integer | |
description: "Discount priority." | |
isEnabled: | |
type: boolean | |
description: "Indicates whether the discount is enabled." | |
userId: | |
type: integer | |
description: "User ID of discount creator." | |
rule: | |
type: object | |
description: "Describes how the discount is calculated: percentage or fixed." | |
properties: | |
type: | |
type: string | |
description: "Discount type." | |
amount: | |
type: integer | |
description: "Discount amount." | |
startDate: | |
type: datetime | |
description: "Defines when the discount starts." | |
endDate: | |
type: datetime | |
description: "Defines when the discount starts." | |
translations: | |
type: array | |
description: "Translations of discount data." | |
items: | |
type: object | |
properties: | |
languageCode: | |
type: string | |
name: | |
type: string | |
description: | |
type: string | |
label: | |
type: string | |
labelDescription: | |
type: string | |
conditions: | |
type: array | |
description: "List of discount conditions." | |
items: | |
type: DiscountCondition | |
DiscountListWrapper: | |
type: object | |
description: 'Wrapper object for DiscountList.' | |
properties: | |
DiscountList: | |
type: object | |
description: 'Object containing a list of discounts.' | |
properties: | |
Discount: | |
type: array | |
items: | |
type: object | |
properties: | |
identifier: | |
type: string | |
description: "Discount identifier." | |
type: | |
type: string | |
description: "Discount type: cart or catalog." | |
priority: | |
type: integer | |
description: "Discount priority." | |
isEnabled: | |
type: boolean | |
description: "Indicates whether the discount is enabled." | |
userId: | |
type: integer | |
description: "User ID of discount creator." | |
rule: | |
type: object | |
description: "Describes how the discount is calculated: percentage or fixed." | |
properties: | |
type: | |
type: string | |
description: "Discount type." | |
amount: | |
type: integer | |
description: "Discount amount." | |
startDate: | |
type: datetime | |
description: "Defines when the discount starts." | |
endDate: | |
type: datetime | |
description: "Defines when the discount starts." | |
translations: | |
type: array | |
description: "Translations of discount data." | |
items: | |
type: object | |
properties: | |
languageCode: | |
type: string | |
name: | |
type: string | |
description: | |
type: string | |
label: | |
type: string | |
labelDescription: | |
type: string | |
conditions: | |
type: array | |
description: "List of discount conditions." | |
items: | |
type: DiscountCondition |
Same for every JSON-only object types below…
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* [Discounts] Described Discounts API * Apply suggestions from code review --------- Co-authored-by: Adrien Dupuis <[email protected]>
* [Discounts] Configuration * Apply suggestions from code review --------- Co-authored-by: Adrien Dupuis <[email protected]>
code_samples/ change report
|
* [Discounts] Described Discounts API (#2783) * [Discounts] Configuration (#2781) --------- Co-authored-by: Adrien Dupuis <[email protected]>
Added description of Discount REST API.
Previews: